function getXMLHttp()
{
    var xmlHttp;
    try{
	xmlHttp = new XMLHttpRequest();
    }
    catch(e)
    {
	// Internet Explorer is different than the orhters
	try
	{
	    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	    }
	    catch(e)
	    {
		console.log("浏览器太过老旧，请使用最新的IE，chrome或者firefox");
		//alert("浏览器太过老旧，请使用最新的IE，chrome或者firefox");
		return false;
	    }
	}
    }
    return xmlHttp;
}

function AjaxRequest(){
    var xmlHttp = getXMLHttp();
    xmlHttp.onreadystatechange = function()
    {
	if(xmlHttp.readyState == 4)
	{
	    HandleResponse(xmlHttp.responseText);
	}
    }
    xmlHttp.open("GET","http://localhost/json.php", true);
    xmlHttp.send(null);
}
function HandleResponse(response)
{
    console.log(response);
}
AjaxRequest();
